negotiator.protocol
Class Protocol

java.lang.Object
  extended by negotiator.protocol.Protocol
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable
Direct Known Subclasses:
AlternatingOffersProtocol, AuctionProtocol

public abstract class Protocol
extends java.lang.Object
implements java.lang.Runnable, java.io.Serializable

Abstract class for the manager of protocols. Implement start() to define the protocol.

See Also:
Serialized Form

Field Summary
protected  Domain domain
          --
protected  java.lang.Thread negoThread
           
protected  int sessionNr
           
 boolean stopNegotiation
          stopNegotiation indicates that the session has now ended.
protected  int totalSessions
           
protected  TournamentRunner tournamentRunner
           
 
Constructor Summary
Protocol(AgentRepItem[] agentRepItems, ProfileRepItem[] profileRepItems, java.util.HashMap<AgentParameterVariable,AgentParamValue>[] agentParams, int totalMatches)
           
 
Method Summary
 void addNegotiationEventListener(NegotiationEventListener listener)
           
 void fireBilateralAtomicNegotiationSessionEvent(BilateralAtomicNegotiationSession session, ProfileRepItem profileA, ProfileRepItem profileB, AgentRepItem agentA, AgentRepItem agentB, java.lang.String agenAName, java.lang.String agentBName)
           
 void fireLogMessage(java.lang.String source, java.lang.String log)
           
 void fireNegotiationActionEvent(Agent actorP, Action actP, int roundP, long elapsed, double time, double utilA, double utilB, double utilADiscount, double utilBDiscount, java.lang.String remarks, boolean finalActionEvent)
           
 java.lang.String getAgentName(int index)
           
 java.util.HashMap<AgentParameterVariable,AgentParamValue> getAgentParams(int index)
           
 AgentRepItem getAgentRepItem(int index)
           
 UtilitySpace getAgentUtilitySpaces(int index)
           
 Domain getDomain()
           
abstract  java.lang.String getName()
           
 java.util.ArrayList<NegotiationEventListener> getNegotiationEventListeners()
           
abstract  NegotiationOutcome getNegotiationOutcome()
           
 int getNumberOfAgents()
           
 ProfileRepItem getProfileRepItems(int index)
           
 int getSessionNumber()
           
 int getTotalSessions()
           
static java.util.ArrayList<Protocol> getTournamentSessions(Tournament tournament)
           
 int hashCode()
           
protected  void loadAgentsUtilitySpaces()
           
 void removeNegotiationEventListener(NegotiationEventListener listener)
           
 void setTournamentRunner(TournamentRunner runner)
           
 void startSession()
           
 void stopNegotiation()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

negoThread

protected java.lang.Thread negoThread

tournamentRunner

protected TournamentRunner tournamentRunner

stopNegotiation

public boolean stopNegotiation
stopNegotiation indicates that the session has now ended. it is checked after every call to the agent, and if it happens to be true, session is immediately returned without any updates to the results list. This is because killing the thread in many cases will return Agent.getAction() but with a stale action. By setting stopNegotiation to true before killing, the agent will still immediately return.


domain

protected Domain domain
--


sessionNr

protected int sessionNr

totalSessions

protected int totalSessions
Constructor Detail

Protocol

public Protocol(AgentRepItem[] agentRepItems,
                ProfileRepItem[] profileRepItems,
                java.util.HashMap<AgentParameterVariable,AgentParamValue>[] agentParams,
                int totalMatches)
         throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getName

public abstract java.lang.String getName()

getNegotiationOutcome

public abstract NegotiationOutcome getNegotiationOutcome()

getTournamentSessions

public static java.util.ArrayList<Protocol> getTournamentSessions(Tournament tournament)
                                                           throws java.lang.Exception
Throws:
java.lang.Exception

startSession

public final void startSession()

loadAgentsUtilitySpaces

protected void loadAgentsUtilitySpaces()
                                throws java.lang.Exception
Throws:
java.lang.Exception

addNegotiationEventListener

public void addNegotiationEventListener(NegotiationEventListener listener)

getNegotiationEventListeners

public java.util.ArrayList<NegotiationEventListener> getNegotiationEventListeners()

removeNegotiationEventListener

public void removeNegotiationEventListener(NegotiationEventListener listener)

fireNegotiationActionEvent

public void fireNegotiationActionEvent(Agent actorP,
                                       Action actP,
                                       int roundP,
                                       long elapsed,
                                       double time,
                                       double utilA,
                                       double utilB,
                                       double utilADiscount,
                                       double utilBDiscount,
                                       java.lang.String remarks,
                                       boolean finalActionEvent)

fireBilateralAtomicNegotiationSessionEvent

public void fireBilateralAtomicNegotiationSessionEvent(BilateralAtomicNegotiationSession session,
                                                       ProfileRepItem profileA,
                                                       ProfileRepItem profileB,
                                                       AgentRepItem agentA,
                                                       AgentRepItem agentB,
                                                       java.lang.String agenAName,
                                                       java.lang.String agentBName)

fireLogMessage

public void fireLogMessage(java.lang.String source,
                           java.lang.String log)

setTournamentRunner

public void setTournamentRunner(TournamentRunner runner)

getDomain

public Domain getDomain()

getAgentRepItem

public AgentRepItem getAgentRepItem(int index)

getProfileRepItems

public ProfileRepItem getProfileRepItems(int index)

getAgentName

public java.lang.String getAgentName(int index)

getAgentParams

public java.util.HashMap<AgentParameterVariable,AgentParamValue> getAgentParams(int index)

getAgentUtilitySpaces

public UtilitySpace getAgentUtilitySpaces(int index)

getNumberOfAgents

public int getNumberOfAgents()

stopNegotiation

public void stopNegotiation()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getSessionNumber

public int getSessionNumber()

getTotalSessions

public int getTotalSessions()